#!/bin/bash

APP_FOLDER=$1
# complete app folder path
if [[ "${APP_FOLDER}" != "/"* ]]; then
    # handle relative path
    if [ ! -d "${APP_FOLDER}" ]; then
        # relative path from current folder does not exist
        # use relative path in workspace apps folder
        APP_FOLDER="/workspace/apps/${APP_FOLDER}"
    else
        APP_FOLDER=$(realpath $APP_FOLDER)
    fi
fi

pushd $APP_FOLDER
cmake --preset qemu-aarch64 && cmake --build --preset qemu-aarch64
popd
